<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>==和===</title>
	</head>
	<body>
		<script type="text/javascript">
var num=[31,5,122,14,56,8,88];
function arr(num,b){
num.sort(function(a,b){
    return a-b;
});
document.write(num + "<br />");

for(var i=0;i<num.length;i++){

	if(b-num[i]<=0){
		num.splice(i,0,b);
		console.log(i);
		break;
	}
}




document.write(num);
}
arr(num,15);
		</script>
	</body>
</html>